package impl.cglibimpl;

import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;

/**
 * Created by chenjun on 2017/11/22.
 */
public class CglibProxyGenerator {
    public static  Object newProxyInstance(Class<?>[] interfaces, MethodInterceptor interceptor) {
        Enhancer enhancer = new Enhancer();
        enhancer.setCallback(interceptor);
        enhancer.setInterfaces(interfaces);
        Object cglibProxy =  enhancer.create();
        return cglibProxy;
    }
}
